#{extends 'Admin.html'/}
#{set title:'Admin -> Input Banner' /}


<h1>Quản lý banner</h1>
<div class="adminTitleIntro">Sử dụng để nhập banner hoặc slide home</div>

#{form @Banners.save(), class:"simpleForm", enctype:'multipart/form-data', id:"formBanner"}
<input type="hidden" value="${dto.id}" name="dto.id">

<p>
    <label> Language : </label>
    <input type="text" value="${lang}" name="dto.language" disabled="true">
</p>

<p>
    <label> Code : </label>
    <input type="text" value="${dto.code}" name="dto.code" >
</p>

<p>
    <label> Url : </label> <input type="text" value="${dto.url}" name="dto.url">
</p>

<p>
    <label> Title : </label> <input type="text" value="${dto.title}" name="dto.title">
</p>

<p>
    <label> Type : </label>
    #{if dto != null}
        #{select 'dto.type', items:allBannerTypes, valueProperty:'code', labelProperty:'name', id:'type', value:dto.type /}
    #{/if}
    #{else}
        #{select 'dto.type', items:allBannerTypes, valueProperty:'code', labelProperty:'name', id:'type'/}
    #{/else}
</p>

<p>
    <label> Order : </label><input type="text" size="300" value="${dto.order}" name="dto.order">
</p>

<p>
    <label> Photo: </label>
    <img width="800px" src="@{User.getBannerImage(dto.id)}" alt="">
    <br>
    <label>&nbsp;</label>
    <input type="file" name="dto.photo">
</p>

<br class="clearfloat">

<div class="controls">
    <input type="submit" value="Save" />
    <input type="button" value="Cancel" onclick="document.href = '/banners/list'"/>
</div>


#{/form}

#{if dto.id != null }
    #{form @delete(dto.id)}
    <p class="crudDelete">
        <input type="submit" value="&{'crud.delete', type.modelName}" />
    </p>
    #{/form}
#{/if}